//
//  CPageDataStruct.mm
//  AudiHistory
//
//  Created by niko on 11-8-21.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "CPageDataStruct.h"

@implementation CPageDataStruct
@synthesize nPage;
@synthesize strImageL;
@synthesize strImageR;
@synthesize strImageThumb;

@end

static CPageDataStructTable *sharedPageDataStructSingletonManager = nil;
@implementation CPageDataStructTable
//单件类所要做得东西----------------------------------------------------------------
+(CPageDataStructTable*)SharedObj
{
	@synchronized(self) 
	{
		if (sharedPageDataStructSingletonManager == nil) 
		{
			[[self alloc] init]; // assignment not done here
		}
	}
	return sharedPageDataStructSingletonManager;
}

+ (id)allocWithZone:(NSZone *)zone
{
	@synchronized(self) {
        if (sharedPageDataStructSingletonManager == nil) {
            sharedPageDataStructSingletonManager = [super allocWithZone:zone];
            return sharedPageDataStructSingletonManager;  // assignment and return on first allocation
        }
    }
    return nil; // on subsequent allocation attempts return nil	
}

- (id)copyWithZone:(NSZone *)zone
{
    return self;
}

- (id)retain
{
    return self;
}

- (NSUInteger)retainCount
{
    return NSUIntegerMax;  //denotes an object that cannot be released
}

- (void)release
{
    //do nothing
}

- (id)autorelease
{
    return self;
}

-(id) init
{
	if( (self = [super init]))
	{
		[self InitData];
	}
	
	return self;
}

-(void)InitData
{
#define PageItem(b,c,d)\
	pPageDataStruct = [[CPageDataStruct alloc] init];\
	pPageDataStruct.nPage = i;\
	pPageDataStruct.strImageL = b;\
	pPageDataStruct.strImageR = c;\
	pPageDataStruct.strImageThumb = d;\
	[arrayTemp addObject:pPageDataStruct];\
	[pPageDataStruct release];\
	pPageDataStruct = nil;\
	i++;\
	
	NSMutableArray *arrayTemp = [NSMutableArray array];
	
	CPageDataStruct *pPageDataStruct = nil;
	int i = 0;
	
	//PageItem(@"audi_history_000-L.jpg",@"audi_history_000-R.jpg",@"audi_history_000-thumb.png");
	//PageItem(@"audi_history_001-L.jpg",@"audi_history_001-R.jpg",@"audi_history_001-thumb.png");
	//PageItem(@"audi_history_002-L.jpg",@"audi_history_002-R.jpg",@"audi_history_002-thumb.png");
	//PageItem(@"audi_history_003-L.jpg",@"audi_history_003-R.jpg",@"audi_history_003-thumb.png");
	PageItem(@"audi_history_004-L.jpg",@"audi_history_004-R.jpg",@"audi_history_004-thumb.png");
	//PageItem(@"audi_history_005-L.jpg",@"audi_history_005-R.jpg",@"audi_history_005-thumb.png");
	PageItem(@"audi_history_006-L.jpg",@"audi_history_006-R.jpg",@"audi_history_006-thumb.png");
	//PageItem(@"audi_history_007-L.jpg",@"audi_history_007-R.png",@"audi_history_007-thumb.png");
	PageItem(@"audi_history_008-L.jpg",@"audi_history_008-R.jpg",@"audi_history_008-thumb.png");
	//PageItem(@"audi_history_009-L.jpg",@"audi_history_009-R.jpg",@"audi_history_009-thumb.png");
	PageItem(@"audi_history_010-L.jpg",@"audi_history_010-R.jpg",@"audi_history_010-thumb.png");
	PageItem(@"audi_history_011-L.jpg",@"audi_history_011-R.jpg",@"audi_history_011-thumb.png");
	PageItem(@"audi_history_012-L.jpg",@"audi_history_012-R.jpg",@"audi_history_012-thumb.png");
	PageItem(@"audi_history_014-L.jpg",@"audi_history_014-R.jpg",@"audi_history_013-thumb.png");
	//PageItem(@"audi_history_014-L.jpg",@"audi_history_014-R.jpg",@"audi_history_014-thumb.png");
	PageItem(@"audi_history_015-L.jpg",@"audi_history_015-R.jpg",@"audi_history_015-thumb.png");
	//PageItem(@"audi_history_016-L.jpg",@"audi_history_016-R.jpg",@"audi_history_016-thumb.png");
	PageItem(@"audi_history_017-L.jpg",@"audi_history_017-R.jpg",@"audi_history_017-thumb.png");
	PageItem(@"audi_history_018-L.jpg",@"audi_history_018-R.jpg",@"audi_history_018-thumb.png");
	PageItem(@"audi_history_019-L.jpg",@"audi_history_019-R.jpg",@"audi_history_019-thumb.png");
	PageItem(@"audi_history_020-L.jpg",@"audi_history_020-R.jpg",@"audi_history_020-thumb.png");
	PageItem(@"audi_history_021-L.jpg",@"audi_history_021-R.jpg",@"audi_history_021-thumb.png");
	PageItem(@"audi_history_022-L.jpg",@"audi_history_022-R.jpg",@"audi_history_022-thumb.png");
	PageItem(@"audi_history_023-L.jpg",@"audi_history_023-R.jpg",@"audi_history_023-thumb.png");
	PageItem(@"audi_history_024-L.jpg",@"audi_history_024-R.jpg",@"audi_history_024-thumb.png");
	PageItem(@"audi_history_025-L.jpg",@"audi_history_025-R.jpg",@"audi_history_025-thumb.png");
	PageItem(@"audi_history_026-L.jpg",@"audi_history_026-R.jpg",@"audi_history_026-thumb.png");
	PageItem(@"audi_history_027-L.jpg",@"audi_history_027-R.jpg",@"audi_history_027-thumb.png");
	PageItem(@"audi_history_028-L.jpg",@"audi_history_028-R.jpg",@"audi_history_028-thumb.png");
	PageItem(@"audi_history_029-L.jpg",@"audi_history_029-R.jpg",@"audi_history_029-thumb.png");
	PageItem(@"audi_history_030-L.jpg",@"audi_history_030-R.jpg",@"audi_history_030-thumb.png");
	PageItem(@"audi_history_031-L.jpg",@"audi_history_031-R.jpg",@"audi_history_031-thumb.png");
	PageItem(@"audi_history_032-L.jpg",@"audi_history_032-R.jpg",@"audi_history_032-thumb.png");
	PageItem(@"audi_history_033-L.jpg",@"audi_history_033-R.jpg",@"audi_history_033-thumb.png");
	PageItem(@"audi_history_034-L.jpg",@"audi_history_034-R.jpg",@"audi_history_034-thumb.png");
	PageItem(@"audi_history_035-L.jpg",@"audi_history_035-R.jpg",@"audi_history_035-thumb.png");
	PageItem(@"audi_history_036-L.jpg",@"audi_history_036-R.jpg",@"audi_history_036-thumb.png");
	PageItem(@"audi_history_037-L.jpg",@"audi_history_037-R.jpg",@"audi_history_037-thumb.png");
	PageItem(@"audi_history_038-L.jpg",@"audi_history_038-R.jpg",@"audi_history_038-thumb.png");
	PageItem(@"audi_history_039-L.jpg",@"audi_history_039-R.jpg",@"audi_history_039-thumb.png");
	PageItem(@"audi_history_040-L-R.jpg",@"audi_history_040-R-R.jpg",@"audi_history_040-thumb.png");
	PageItem(@"audi_history_041-L.jpg",@"audi_history_041-R.jpg",@"audi_history_041-thumb.png");
	PageItem(@"audi_history_042-L.jpg",@"audi_history_042-R.jpg",@"audi_history_042-thumb.png");
	PageItem(@"audi_history_043-L.jpg",@"audi_history_043-R.jpg",@"audi_history_043-thumb.png");
	PageItem(@"audi_history_044-L.jpg",@"audi_history_044-R.jpg",@"audi_history_044-thumb.png");
	PageItem(@"audi_history_045-L.jpg",@"audi_history_045-R.jpg",@"audi_history_045-thumb.png");
	PageItem(@"audi_history_046-L.jpg",@"audi_history_046-R.jpg",@"audi_history_046-thumb.png");
	PageItem(@"audi_history_047-L.jpg",@"audi_history_047-R.jpg",@"audi_history_047-thumb.png");
	//PageItem(@"audi_history_048-L.jpg",@"audi_history_048-R.jpg",@"audi_history_048-thumb.png");
	
	//PageItem(@"audi_history_0491-L.png",@"audi_history_0491-R.png",@"audi_history_0491-thumb.png");
	
	PageItem(@"audi_history_049-L.jpg",@"audi_history_049-R.jpg",@"audi_history_049-thumb.png");
	//PageItem(@"audi_history_050-L.jpg",@"audi_history_050-R.jpg",@"audi_history_050-thumb.png");
	PageItem(@"audi_history_051-L.jpg",@"audi_history_051-R.jpg",@"audi_history_051-thumb.png");
	//PageItem(@"audi_history_052-L.jpg",@"audi_history_052-R.jpg",@"audi_history_052-thumb.png");
	PageItem(@"audi_history_053-L.jpg",@"audi_history_053-R.jpg",@"audi_history_053-thumb.png");
	//PageItem(@"audi_history_054-L.jpg",@"audi_history_054-R.jpg",@"audi_history_054-thumb.png");
	PageItem(@"audi_history_055-L.jpg",@"audi_history_055-R.jpg",@"audi_history_055-thumb.png");
	//PageItem(@"audi_history_056-L.jpg",@"audi_history_056-R.jpg",@"audi_history_056-thumb.png");
	PageItem(@"audi_history_057-L.jpg",@"audi_history_057-R.jpg",@"audi_history_057-thumb.png");
	PageItem(@"audi_history_058-L.jpg",@"audi_history_058-R.jpg",@"audi_history_058-thumb.png");
	//PageItem(@"audi_history_059-L.jpg",@"audi_history_059-R.jpg",@"audi_history_059-thumb.png");
	PageItem(@"audi_history_060-L.jpg",@"audi_history_060-R.jpg",@"audi_history_060-thumb.png");
	//PageItem(@"audi_history_061-L.jpg",@"audi_history_061-R.jpg",@"audi_history_061-thumb.png");
	PageItem(@"audi_history_062-L.jpg",@"audi_history_062-R.jpg",@"audi_history_062-thumb.png");
	//PageItem(@"audi_history_063-L.jpg",@"audi_history_063-R.jpg",@"audi_history_063-thumb.png");
	PageItem(@"audi_history_064-L.jpg",@"audi_history_064-R.jpg",@"audi_history_064-thumb.png");
	PageItem(@"audi_history_065-L.jpg",@"audi_history_065-R.jpg",@"audi_history_065-thumb.png");
	PageItem(@"audi_history_066-L.jpg",@"audi_history_066-R.jpg",@"audi_history_066-thumb.png");
	PageItem(@"audi_history_067-L.jpg",@"audi_history_067-R.jpg",@"audi_history_067-thumb.png");
	PageItem(@"audi_history_068-L.jpg",@"audi_history_068-R.jpg",@"audi_history_068-thumb.png");
	PageItem(@"audi_history_069-L.jpg",@"audi_history_069-R.jpg",@"audi_history_069-thumb.png");
	PageItem(@"audi_history_070-L.jpg",@"audi_history_070-R.jpg",@"audi_history_070-thumb.png");
	PageItem(@"audi_history_071-L.jpg",@"audi_history_071-R.jpg",@"audi_history_071-thumb.png");
	PageItem(@"audi_history_072-L.jpg",@"audi_history_072-R.jpg",@"audi_history_072-thumb.png");
	PageItem(@"audi_history_073-L.jpg",@"audi_history_073-R.jpg",@"audi_history_073-thumb.png");
	PageItem(@"audi_history_074-L.jpg",@"audi_history_074-R.jpg",@"audi_history_074-thumb.png");
	PageItem(@"audi_history_075-L.jpg",@"audi_history_075-R.jpg",@"audi_history_075-thumb.png");
	PageItem(@"audi_history_076-L.jpg",@"audi_history_076-R.jpg",@"audi_history_076-thumb.png");
	PageItem(@"audi_history_077-L.jpg",@"audi_history_077-R.jpg",@"audi_history_077-thumb.png");
	PageItem(@"audi_history_078-L.jpg",@"audi_history_078-R.jpg",@"audi_history_078-thumb.png");
	PageItem(@"audi_history_079-L.jpg",@"audi_history_079-R.jpg",@"audi_history_079-thumb.png");
	PageItem(@"audi_history_080-L.jpg",@"audi_history_080-R.jpg",@"audi_history_080-thumb.png");
	PageItem(@"audi_history_081-L.jpg",@"audi_history_081-R.jpg",@"audi_history_081-thumb.png");
	PageItem(@"audi_history_082-L.jpg",@"audi_history_082-R.jpg",@"audi_history_082-thumb.png");
	PageItem(@"audi_history_083-L.jpg",@"audi_history_083-R.jpg",@"audi_history_083-thumb.png");
	PageItem(@"audi_history_084-L.jpg",@"audi_history_084-R.jpg",@"audi_history_084-thumb.png");
	PageItem(@"audi_history_085-L.jpg",@"audi_history_085-R.jpg",@"audi_history_085-thumb.png");
	PageItem(@"audi_history_086-L.jpg",@"audi_history_086-R.jpg",@"audi_history_086-thumb.png");
	PageItem(@"audi_history_087-L.jpg",@"audi_history_087-R.jpg",@"audi_history_087-thumb.png");
	PageItem(@"audi_history_088-L.jpg",@"audi_history_088-R.jpg",@"audi_history_088-thumb.png");
	PageItem(@"audi_history_089-L.jpg",@"audi_history_089-R.jpg",@"audi_history_089-thumb.png");
	PageItem(@"audi_history_090-L.jpg",@"audi_history_090-R.jpg",@"audi_history_090-thumb.png");
	PageItem(@"audi_history_091-L.jpg",@"audi_history_091-R.jpg",@"audi_history_091-thumb.png");
	PageItem(@"audi_history_092-L.jpg",@"audi_history_092-R.jpg",@"audi_history_092-thumb.png");
	PageItem(@"audi_history_093-L.jpg",@"audi_history_093-R.jpg",@"audi_history_093-thumb.png");
	PageItem(@"audi_history_094-L.jpg",@"audi_history_094-R.jpg",@"audi_history_094-thumb.png");
	PageItem(@"audi_history_095-L.jpg",@"audi_history_095-R.jpg",@"audi_history_095-thumb.png");
	PageItem(@"audi_history_096-L.jpg",@"audi_history_096-R.jpg",@"audi_history_096-thumb.png");
	PageItem(@"audi_history_097-L.jpg",@"audi_history_097-R.jpg",@"audi_history_097-thumb.png");
	PageItem(@"audi_history_098-L.jpg",@"audi_history_098-R.jpg",@"audi_history_098-thumb.png");
	PageItem(@"audi_history_099-L.jpg",@"audi_history_099-R.jpg",@"audi_history_099-thumb.png");
	PageItem(@"audi_history_100-L.jpg",@"audi_history_100-R.jpg",@"audi_history_100-thumb.png");
	PageItem(@"audi_history_101-L.jpg",@"audi_history_101-R.jpg",@"audi_history_101-thumb.png");
	PageItem(@"audi_history_102-L.jpg",@"audi_history_102-R.jpg",@"audi_history_102-thumb.png");
	PageItem(@"audi_history_103-L.jpg",@"audi_history_103-R.jpg",@"audi_history_103-thumb.png");
	PageItem(@"audi_history_104-L.jpg",@"audi_history_104-R.jpg",@"audi_history_104-thumb.png");
	PageItem(@"audi_history_105-L.jpg",@"audi_history_105-R.jpg",@"audi_history_105-thumb.png");
	PageItem(@"audi_history_106-L.jpg",@"audi_history_106-R.jpg",@"audi_history_106-thumb.png");
	PageItem(@"audi_history_107-L.jpg",@"audi_history_107-R.jpg",@"audi_history_107-thumb.png");
	PageItem(@"audi_history_108-L.jpg",@"audi_history_108-R.jpg",@"audi_history_108-thumb.png");
	PageItem(@"audi_history_109-L.jpg",@"audi_history_109-R.jpg",@"audi_history_109-thumb.png");
	PageItem(@"audi_history_110-L.jpg",@"audi_history_110-R.jpg",@"audi_history_110-thumb.png");
	PageItem(@"audi_history_111-L.jpg",@"audi_history_111-R.jpg",@"audi_history_111-thumb.png");
	PageItem(@"audi_history_112-L.jpg",@"audi_history_112-R.jpg",@"audi_history_112-thumb.png");
	PageItem(@"audi_history_113-L.jpg",@"audi_history_113-R.jpg",@"audi_history_113-thumb.png");
	PageItem(@"audi_history_114-L.jpg",@"audi_history_114-R.jpg",@"audi_history_114-thumb.png");
	PageItem(@"audi_history_115-L.jpg",@"audi_history_115-R.jpg",@"audi_history_115-thumb.png");
	//PageItem(@"audi_history_116-L.jpg",@"audi_history_116-R.jpg",@"audi_history_116-thumb.png");
	//PageItem(@"audi_history_117-L.jpg",@"audi_history_117-R.jpg",@"audi_history_117-thumb.png");
	PageItem(@"audi_history_118-L.jpg",@"audi_history_118-R.jpg",@"audi_history_118-thumb.png");
	PageItem(@"audi_history_119-L.jpg",@"audi_history_119-R.jpg",@"audi_history_119-thumb.png");
	PageItem(@"audi_history_120-L.jpg",@"audi_history_120-R.jpg",@"audi_history_120-thumb.png");
	
	m_arrayData = [arrayTemp retain];
}

-(void)ClearData
{
	RELEASE_OBJECT(m_arrayData);
}

-(int)GetPageCount
{
	return [m_arrayData count];
}

+(CPageDataStruct*)GetPageDataByPagenum:(int)nPage
{
	return [[self SharedObj] GetPageDataByPagenum:nPage];
}

-(CPageDataStruct*)GetPageDataByPagenum:(int)nPage
{
	CPageDataStruct *pPageDataStruct = nil;
	
	for(CPageDataStruct *pPageDataStruct2 in m_arrayData)
	{
		if (pPageDataStruct2.nPage == nPage)
		{
			return pPageDataStruct2;
		}
	}
	
	return pPageDataStruct;
}

@end
